package main

import (
	"fmt"
)

func lengthOfLongestSubstring(s string) int {
	hmap := map[byte]int{}
	byteS := []byte(s)
	res := 0
	for left, right := 0, 0; right < len(s); right++ {
		rightvalue := byteS[right]
		for hmap[rightvalue] != 0 {
			delete(hmap, byteS[left])
			left++
		}
		hmap[rightvalue]++
		res = max(res, right-left+1)
	}
	return res
}
func main() {
	num := lengthOfLongestSubstring("pwwkew")
	fmt.Println(num)
}
